package org.springframework.util.xml;


import org.apache.commons.logging.Log;
import org.xml.sax.ErrorHandler;
import org.xml.sax.SAXException;
import org.xml.sax.SAXParseException;

public class SimpleSaxErrorHandler implements ErrorHandler {

    private final Log logger;
    
    public SimpleSaxErrorHandler(Log logger) {
        this.logger = logger;
    }
    @Override
    public void error(SAXParseException exception) throws SAXException {
        throw exception;
    }

    @Override
    public void fatalError(SAXParseException exception) throws SAXException {
        throw exception;        
    }

    @Override
    public void warning(SAXParseException exception) throws SAXException {
        logger.warn("Ignored XML validation warning", exception);        
    }

}
